//
//  UIBarButtonItam+Extensions.swift
//  新浪微博
//
//  Created by shanlin on 2017/8/11.
//  Copyright © 2017年 shanlin. All rights reserved.
//

import Foundation


extension UIBarButtonItem {
    convenience init(title: String, fontSize:CGFloat = 16, target: AnyObject, action: Selector, isBack:Bool = false) {
        let btn: UIButton = UIButton.cz_textButton(title, fontSize: fontSize, normalColor: UIColor.darkGray, highlightedColor: UIColor.orange)
        
        if isBack {
            let image = "navigationbar_back_withtext"
            
//            navigationbar_back_withtext_highlighted
            btn.setImage(UIImage.init(named: image), for: .normal)
            btn.setImage(UIImage.init(named: image + "_highlighted"), for: .highlighted)
            btn.sizeToFit()
        }
        
        btn.addTarget(target, action: action, for: .touchUpInside)
        self.init(customView:btn)
    }
}
    
